// 响应数据中间件
const dispatch = (req, res, next) => {
    res.dispatch = (status, msg, data) => {
        res.send({
            status,
            msg: msg instanceof Error ? msg.message : msg,
            data
        })
    }
    next();
}
module.exports = dispatch;